package com.example.perplonews.a_d_fragment.b_perplo

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import androidx.viewpager.widget.ViewPager
import com.example.perplonews.R
import com.example.perplonews.a_d_fragment.b_perplo.adapter.PerploVpAdapter
import com.example.perplonews.a_d_fragment.b_perplo.fragment.Love_Fragment
import com.example.perplonews.a_d_fragment.b_perplo.fragment.Recommond_Fragment
import com.flyco.tablayout.SlidingTabLayout

class PerploFragment : Fragment() {
    private val perploSearch: ImageView by lazy { myview!!.findViewById<ImageView>(R.id.perplo_search) }
    private val perploTab: SlidingTabLayout by lazy { myview!!. findViewById<SlidingTabLayout>(R.id.perplo_tab) }
    private val perploVp: ViewPager by lazy {  myview!!.findViewById<ViewPager>(R.id.perplo_vp) }
    private var myview: View? = null

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        myview = inflater.inflate(R.layout.fragment_perplo, container, false)
        init()
        return myview
    }

    private fun init() {
        var list:ArrayList<Fragment> = ArrayList()
        list.add(Recommond_Fragment())
        list.add(Love_Fragment())
        perploVp.adapter = PerploVpAdapter(activity?.supportFragmentManager!!,list)
        perploTab.setViewPager(perploVp)
    }


}